/**
 * 封装购物车相关接口
 */
import http from '@/utils/http'

/**
 * 添加商品到购物车
 * @param skuId
 * @param count
 * @return {*}
 */
export function addCartAPI({ skuId, count }) {
  return http({
    url: '/member/cart',
    method: 'POST',
    data: {
      skuId,
      count
    }
  })
}

/**
 * 获取最新的购物车列表
 * @return {*}
 */
export function findNewCartListAPI() {
  return http({
    url: '/member/cart',
    method: 'GET'
  })
}

/**
 * 删除购物车
 * @param ids
 * @return {*}
 */
export function deleteCartAPI(ids) {
  return http({
    url: '/member/cart',
    method: 'DELETE',
    data: {
      ids
    }
  })
}

export function mergeCartAPI(data) {
  return http({
    url: '/member/cart/merge',
    method: 'POST',
    data
  })
}
